<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>切换数据源</title>
    <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
</head>
<body>
<div>
    请选择数据源：
    <select onchange="handleDataSourceChange(this.options[this.options.selectedIndex].value)">
        <option value="请选择">请选择</option>
        <option value="master">master</option>
        <option value="slave">slave</option>
    </select>
</div>
<div id="result">

</div>
<button onclick="handleDataLoad()">加载数据</button>

<script>
    function handleDataSourceChange(value) {
        $.post("/system/config/data_source_type", {
            dataSourceType: value
        })
    }
    function handleDataLoad() {
        $.get("/user/list", function (data) {
            $("#result").html(JSON.stringify(data))
        })
    }
</script>
</body>
</html>